//
//  UIView+Extension.m
//  UIFiterDemo
//
//  Created by wyy on 16/10/12.
//  Copyright © 2016年 yyx. All rights reserved.
//

#import "UIView+ComboBoxExtension.h"

@implementation UIView (Extension)
- (CGFloat)mm_left {
    return self.frame.origin.x;
}

- (void)setMm_left:(CGFloat)x {
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}

- (CGFloat)mm_right {
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setMm_right:(CGFloat)right {
    CGRect frame = self.frame;
    frame.origin.x = right - frame.size.width;
    self.frame = frame;
}

- (CGFloat)mm_top{
    return self.frame.origin.y;
}

- (void)setMm_top:(CGFloat)mm_top
{
    CGRect frame = self.frame;
    frame.origin.y = mm_top;
    self.frame = frame;
}

- (CGFloat)mm_bottom {
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setMm_bottom:(CGFloat)bottom {
    CGRect frame = self.frame;
    frame.origin.y = bottom - frame.size.height;
    self.frame = frame;
}

- (CGFloat)mm_width {
    return self.frame.size.width;
}

- (void)setMm_width:(CGFloat)width {
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}

- (CGFloat)height {
    return self.frame.size.height;
}

- (void)setHeight:(CGFloat)height {
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}

- (CGFloat)mm_height
{
    return self.frame.size.height;
}

- (void)setMm_height:(CGFloat)mm_height
{
    CGRect frame = self.frame;
    frame.size.height = mm_height;
    self.frame = frame;
}

- (void)setMm_offsetX:(CGFloat)offsetX {
    self.frame = CGRectOffset(self.frame, offsetX, 0);
}

- (CGFloat)mm_offsetX {
    return 0;
}

- (void)setMm_offsetY:(CGFloat)offsetY {
    self.frame = CGRectOffset(self.frame, 0, offsetY);
}

- (CGFloat)mm_offsetY {
    return 0;
}

- (void)setMm_size:(CGSize)size {
    self.frame = CGRectMake(self.mm_left, self.mm_top, size.width, size.height);
}

- (CGSize)mm_size {
    return self.frame.size;
}

- (CGPoint)mm_origin {
    return self.frame.origin;
}

- (void)setMm_origin:(CGPoint)origin {
    self.frame = CGRectMake(origin.x, origin.y, self.mm_width, self.mm_height);
}

-(CGFloat)mm_centerX {
    return self.center.x;
}

-(void)setMm_centerX:(CGFloat)centerX {
    self.center=CGPointMake(centerX, self.mm_centerY);
}

-(CGFloat)mm_centerY {
    return self.center.y;
}

-(void)setMm_centerY:(CGFloat)centerY {
    self.center=CGPointMake(self.mm_centerX,centerY);
}

@end
